package com.sqsf.controller;

import com.sqsf.javabean.User;
import com.sqsf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class UserController {
    @Autowired
    UserService userService;

    @RequestMapping("/allUser")
    public ModelAndView allUser(ModelAndView mv){
        List<User> allUser = userService.findAllUser();
        mv.setViewName("ok");
        mv.addObject("allUser",allUser);
        return mv;
    }
}